
/**
 * 主文件
 */
require(["jquery","core","angular.util","angular","angular.route","core.directives","core.filters","core.controllers","manage.controllers"],function($,core,util)
{
	var getIncludePath=function(file)
	{
		return core.System.INCLUDE_PATH+file;
	};
	
	var routes=angular.module("routes",["ngRoute"]);
	
	routes.config(["$routeProvider","$locationProvider",function($routeProvider,$locationProvider)
	{
		var provider={};
		
		provider.index=
		{
			url:"/",
			'default':true,
			templateUrl:getIncludePath("/index.html"),
			controller: "IndexController"
		};
		provider.login=
		{
			url:"/login",
			templateUrl:getIncludePath("/login.html"),
			controller: "LoginController"
		};
		provider.register=
		{
			url:"/register",
			templateUrl:getIncludePath("/register.html"),
			controller: "RegisterController"
		};
		provider.manage=
		{
			url:"/manage",
			templateUrl:getIncludePath("/manage/index.html"),
			controller: "ManageIndexController"
		};
		provider.openApi=
		{
			url:"/openApi",
			templateUrl:getIncludePath("/openApi_show.html"),
			controller: "OpenApiController"	
		};
		
		provider.dongtan=
		{
			show:
			{
				url:"/dongtan",
				templateUrl:getIncludePath("/dongtan_show.html"),
				controller: "DongtanShowController"
			},
			showOne:
			{
				url:"/dongtan/:id",
				templateUrl:getIncludePath("/dongtan_show_one.html"),
				controller: "DongtanShowOneController"
			}
		};
		
		provider.software=
		{
			show:
			{
				url:"/software/recommend",
				templateUrl:getIncludePath("/software_recommend_show.html"),
				controller: "SoftwareRecommendController"
			},
			showOne:
			{
				url:"/software/:id",
				templateUrl:getIncludePath("/software_show_one.html"),
				controller: "SoftwareShowOneController"
			}
		};
		
		provider.discuss=
		{
			forum:
			{
				index:
				{
					url:"/discuss/forum",
					templateUrl:getIncludePath("/discuss_forum_index.html"),
					controller: "DiscussForumIndexController"
				},
				indexByForum:
				{
					url:"/discuss/forum/:id",
					templateUrl:getIncludePath("/discuss_forum_index.html"),
					controller: "DiscussForumIndexController"
				}
			},
			create:
			{
				url:"/discuss/create",
				templateUrl:getIncludePath("/discuss_create.html"),
				controller: "DiscussCreateController"
			},
			showOne:
			{
				url:"/discuss/:id",
				templateUrl:getIncludePath("/discuss_show_one.html"),
				controller: "DiscussShowOneController"
			}
		};
		
		provider.user=
		{
			home:
			{
				url:"/user/home",
				templateUrl:getIncludePath("/user_home_manage.html"),
				controller: "UserHomeManageController"
			},
			homeById:
			{
				url:"/user/:id/home",
				templateUrl:getIncludePath("/user_home.html"),
				controller: "UserHomeController"
			},
			registerCheck:
			{
				url:"/register/check",
				templateUrl:getIncludePath("/register_check.html"),
				controller: "UserRegisterCheckController"
			}
		};
		
		provider.user.mail=
		{
			show:
			{
				url:"/user/mail",
				templateUrl:getIncludePath("/user_mail_show.html"),
				controller: "UserMailShowController"
			}
		};
		
		provider.blog=
		{
			show:
			{
				url:"/user/:id/blog",
				templateUrl:getIncludePath("/blog_show.html"),
				controller: "BlogShowController"
			},
			showByCatalog:
			{
				url:"/user/:id/blog/:catalog",
				templateUrl:getIncludePath("/blog_show.html"),
				controller: "BlogShowController"
			},
			showOne:
			{
				url:"/blog/:id",
				templateUrl:getIncludePath("/blog_show_one.html"),
				controller: "BlogShowOneController"
			}
		};
		
		provider.search=
		{
			index:
			{
				url:"/search",
				templateUrl:getIncludePath("/search_index.html"),
				controller: "SearchIndexController"
			},
			software:
			{
				url:"/search/software",
				templateUrl:getIncludePath("/search_software.html"),
				controller: "SearchSoftwareController"
			},
			blog:
			{
				url:"/search/blog",
				templateUrl:getIncludePath("/search_blog.html"),
				controller: "SearchBlogController"
			},
			discuss:
			{
				url:"/search/discuss",
				templateUrl:getIncludePath("/search_discuss.html"),
				controller: "SearchDiscussController"
			}
		};
		
		//$locationProvider.html5Mode(true).hashPrefix('!');
		util.angular.route.parse(provider,$routeProvider);
	}]);
	
	var app=angular.module("app",["routes","filters","directives","controllers","manage.controllers"]);
	
	angular.bootstrap(document,["app"]);
});